<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ taglib uri="/WEB-INF/lib/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/lib/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/lib/c.tld" prefix="c"%>

<script>

function submitForm(opr){
	document.movimentFinancesReportForm.opr.value = opr;
	document.movimentFinancesReportForm.submit();
}

function search(opr){
	document.movimentFinancesReportForm.opr.value = 'search';
	document.movimentFinancesReportForm.submit();
}

</script>

<html:form action="/movimentFinancesReport">
	<html:hidden property="opr" />
	
<table border="0">
				<tr>
					<td align="center"><h3><bean:message key="vehicle.title.reportFinanceMoviment" /></h3></td>
				</tr>
	
</table>
			<table border="0" width="100%">
				<tr>
					<td width="40%"><bean:message key="moviment.date.begin" />:<br />
					<html:text property="dateBegin" />
					<td width="40%"><bean:message key="moviment.date.end" />:<br />
					<html:text property="dateEnd" />
		   		 	<a href="javascript:search()"><bean:message key="moviment.labels.searchButton" /></a>
					</td>
				</tr>
			</table>
			
<logic:present name="show">
					
<table width="100%" style="border: 1px solid #969696;" cellpadding="0" cellspacing="0">
	<tr style="background-color: #969696; height: 20px; font-weight: bold;">
		<td>&nbsp;</td>
		<td width="25%"><bean:message key="moviment.label.plate" /></td>
		<td width="25%"><bean:message key="moviment.label.type" /></td>
		<td width="25%"><bean:message key="moviment.label.date" /></td>
		<td width="25%"><bean:message key="moviment.label.value" /></td>
		<td>&nbsp;</td>
	</tr>
	
	<logic:iterate id="moviment" name="movimentCollection" >

	<c:choose>
		<c:when test="${color == '#f3f2f2'}">
			<c:set var="color" value="#e7e6e6" scope="page"/>
		</c:when>
		<c:otherwise>
			<c:set var="color" value="#f3f2f2" scope="page"/>
		</c:otherwise>
	</c:choose>
	
		<tr style="background-color: <c:out value="${color}" />; height: 15px;">
			<td>&nbsp;</td>
			<td><bean:write name="moviment" property="vehicle.plate"/></td>
			<td><bean:write name="moviment" property="eventType.eventType"/></td>
			<td><bean:write name="moviment" property="date"/></td>
			<td><bean:write name="moviment" property="value"/></td>
			<td>&nbsp;</td>
		</tr>
	
	</logic:iterate>

</table>
</logic:present>


<logic:present name="error">
	<table border="0">
				<tr>
					<td align="center"><h3><bean:message key="moviment.error.date" /></h3></td>
				</tr>
</table>
</logic:present>

<logic:present name="dataInvalida">
	<table border="0">
				<tr>
					<td align="center"><h3><bean:message key="moviment.error.dateInvalid" /></h3></td>
				</tr>
</table>
</logic:present>

<logic:present name="campoVazio">
	<table border="0">
				<tr>
					<td align="center"><h3><bean:message key="moviment.error.campoVazio" /></h3></td>
				</tr>
</table>
</logic:present>

</html:form>